Những câu hỏi liên quan
NgocTuan
Xem chi tiết
Lê Chiêu Nguyên	Vũ
4 tháng 4 2023 lúc 10:11

program Min;
uses crt;
var i,n:integer;
begin
   clrscr;
   write('Nhap n: '); readln(n);
   write('Cac so le nho hon hoac bang ',n,'la :');
   for i:=1 to n do if i mod 2 = 1 then write(i:4);
   readln
end.

Bình luận (0)
Lê Tâm Anh
Xem chi tiết
gấu béo
7 tháng 5 2023 lúc 19:20

program Le_Nho_Hon_Hoac_Bang_n;

uses crt;

var

       n, i: integer;

begin

       clrscr;

       write('Nhap vao mot so nguyen duong n: ');

       readln(n);

       while n <= 0 do

       begin

              writeln('So ban nhap khong hop le. Xin vui long nhap lai: ');

              readln(n);

       end;

       clrscr;

       writeln('Cac so le nho hon hoac bang ', n, ' la:');

       i := 1;

       while i <= n do

       begin

              if i mod 2 <> 0 then

                     writeln(i);

              i := i + 1;

       end;

       readln;

end.

Bình luận (0)
Phan Đức Duy
Xem chi tiết
hacker
10 tháng 1 2021 lúc 17:31

uses crt;var n: longint;    chrn: string;    valn,sum,max,i,preperror: byte;begin    write('Nhap so can kiem tra: ');    readln(n);    str(n,chrn);    for i:=1 to length(chrn) do    begin        val(chrn[i],valn,preperror);        sum:=sum+valn;        if max<valn then max:=valn;        valn:=0    end;    writeln('Ket qua: ');    writeln(length(chrn));    writeln(sum);    write(max);    readln;end.uses crt;var n: longint;    chrn: string;    valn,sum,max,i,preperror: byte;begin    write('Nhap so can kiem tra: ');    readln(n);    str(n,chrn);    for i:=1 to length(chrn) do    begin        val(chrn[i],valn,preperror);        sum:=sum+valn;        if max<valn then max:=valn;        valn:=0    end;    writeln('Ket qua: ');    writeln(length(chrn));    writeln(sum);    write(max);    readln;end.

Bình luận (0)
Minh Lệ
10 tháng 1 2021 lúc 20:09

Program HOC24;

var N:longint;

max,tg,t,d: integer;

Begin

write('Nhap N : '); readln(N);

max:=0;

while n<>0 do

begin

tg:=n mod 10;

d:=d+1;

t:=t+tg;

if tg>max then max:=tg;

n:=n div 10;

end;

writeln('So nguyen N co ',d,' chu so');

writeln('Tong cac chu so cua N la : ',t);

write('Chu so lon nhat cua N la :',max);

readln

end.

Bình luận (0)
Nguyễn Lê Phước Thịnh
10 tháng 1 2021 lúc 20:11

uses crt;

var n,d,i,t,max,x:longint;

y:integer;

st:string;

begin

clrscr;

repeat

write('Nhap n='); readln(n);

until n>0;

str(n,st);

d:=length(st);

writeln('So chu so cua ',n,' la: ',d);

t:=0;

max:=0;

for i:=1 to d do 

  begin

val(st[i],x,y);

t:=t+x;

if max<x then max:=x;

end;

writeln('Tong cac chu so cua ',n,' la: ',t);

writeln('Chu so lon nhat cua ',n,' la: ',max);

readln;

end.

Bình luận (0)
hoa tran
Xem chi tiết
Nguyễn Lê Phước Thịnh
21 tháng 1 2022 lúc 20:24

#include <bits/stdc++.h>

using namespace std;

long long i,n;

int main()

{

cin>>n;

for (i=1; i<=n; i++) if (i%2==0) cout<<i<<" ";

return 0;

}

Bình luận (0)
Kiều Vũ Linh
22 tháng 1 2022 lúc 8:07

Var n,i,so:integer;

Begin

Write('Nhap n = ');readln(n);

Writeln('Cac so chan tu 1 den n la: ');

For i:=1 to n do

If i mod 2 = 0 then write(i,'   ');

Readln;

End.

Bình luận (0)
Pham Huynh Bao Thy
Xem chi tiết
Yi Ling
Xem chi tiết
Nguyễn Lê Phước Thịnh
25 tháng 12 2021 lúc 9:13

#include <bits/stdc++.h>

using namespace std;

long long n,i,t;

int main()

{

cin>>n;

if ((n>10) and (n<70))

{

t=0;

for (i=1; i<=n; i++)

if (i%2==0) t=t+i;

cout<<t;

}

else cout<<"Nhap lai";

return 0;

}

Bình luận (0)
Gà Công Nghệ
Xem chi tiết
Anh Phạm
28 tháng 8 2021 lúc 19:43

uses crt;

var n,i,o,d:integer;

function ktnt(n:integer): integer;

var i,d:integer;

begin

d:=0;

for i:=1 to sqrt(n) do

if (n mod i=0) then d:=d+1;

if d=2 then ktnt=0

else ktnt=1;

end;

begin

readln(n);

writeln(' so nguyen to be hon hoac bang n la'); {a}

for i:=1 to n do

if ktnt(i)=0 then writeln(i);

writeln('so nguyen to nho nhat khong be hon n');

o:=n;

while o>0 do

begin

if ktnt(o)=0 then

begin

write(o);

break;

end;

o:=o+1;

end;

writeln('cặp số nguyên tố là hai số nguyên lẻ liên tiếp nhỏ hơn hoặc bằng n');

o:=0;

o:=1;

d:=0;

for i:=o+2 to n do

begin

if ktnt(i)=0 then

begin

d:=d+1;

write(i,' ');

if d<2 then continue;

end;

d:=0;

writeln;

end;

readln;

end.

Bình luận (1)
ngomanhcuong
Xem chi tiết
Nguyễn Lê Phước Thịnh
15 tháng 3 2022 lúc 20:25

#include <bits/stdc++.h>

using namespace std;

long long x,n,i,t,dem;

int main()

{

cin>>n;

dem=0;

t=0;

for (i=1; i<=n; i++)

{

cin>>x;

if (x%2==0 && x>10) t+=x;

if (x%2!=0 || x<100) dem++;

}

cout<<t<<" "<<dem;

return 0;

}

Bình luận (0)
Do Ngoc Thao My
Xem chi tiết
Edward Paros
16 tháng 4 2023 lúc 22:05

program TimBoi4ChuSo;
var
  n, i: integer;
begin
  repeat
    writeln('Nhap vao so nguyen n (2<n<100): ');
    readln(n);
  until (n > 2) and (n < 100);
  
  writeln('Cac boi cua ', n, ' co 4 chu so la: ');
  for i := 1000 to 9999 do
  begin
    if i mod n = 0 then
      writeln(i);
  end;
end.

 

Bình luận (0)